Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Add wrapTraceContext to onChangedOperation to enable traceId on onDocumentUpdated #1533

Conversation

JonatanSalas
Copy link

@JonatanSalas JonatanSalas commented Mar 4, 2024

Description

When using firebase-functions v2 traceId is missing for Firestore triggers like onDocumentUpdated.

After a deep dive into the repository's code I've found that there's a difference.

onDocumentCreated relies in the method onOperation which wraps the event handler with the function wrapTraceContext that injects the trace information.

Screenshot 2024-03-04 at 14 14 44

On the other side, onDocumentUpdated relies in the method onChangedOperation which executes the event handler without using the wrapTraceContext function. I don't know if this is intentional, but this is a problem of those who are heavy users of firebase functions under the v2 because in previous version the traceId was available.

Screenshot 2024-03-04 at 14 14 59

I've adapted the code to make onChangedOperation use the wrapTraceContext function. With that line I think we can solve the issue of missing traceId in onDocumentUpdated.

…estore triggers to get the trace information
Copy link

google-cla bot commented Mar 4, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@exaby73
Copy link
Contributor

exaby73 commented Jun 3, 2024

Hey @JonatanSalas. Can you fix the conflicts?

@JonatanSalas
Copy link
Author

@exaby73 sure!

@exaby73
Copy link
Contributor

exaby73 commented Jul 15, 2024

Hey @JonatanSalas. There still seems to be conflicts on this PR

@taeold
Copy link
Contributor

taeold commented Aug 23, 2024

This was fixed in #1531!

Thank you for your help!

@taeold taeold closed this Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firebase Functions v2 missing labels for documentOnwritten
3 participants